import { Provide } from '@midwayjs/decorator';
import { BaseService } from '@cool-midway/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { Repository } from 'typeorm';
import { ErpOrdersEntity } from '../entity/erpOrders';

@Provide()
export class ErpOrdersService extends BaseService {
  @InjectEntityModel(ErpOrdersEntity)
  entity: Repository<ErpOrdersEntity>;

  async upsert(data) {
    return await this.entity.upsert(data, {
      conflictPaths: ['id'],
    });
  }
}
